﻿using QYmall.Core.Common.Emum;
using QYmall.Core.Common.Helper;
using QYmall.Core.Model.Models;
using QYmall.Core.Model.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace QYmall.Core.IServices
{
    /// <summary>
    /// 订单接口
    /// </summary>
    public interface IOrderService : IBaseService
    {
        /// <summary>
        /// 查询一条记录
        /// </summary>
        Task<Orders?> QueryAsync(Expression<Func<Orders, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 查询一条订单货品记录
        /// </summary>
        Task<OrderGoods?> QueryGoodsAsync(Expression<Func<OrderGoods, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 查询指定数量列表
        /// </summary>
        Task<IEnumerable<Orders>> QueryListAsync(int top, Expression<Func<Orders, bool>> funcWhere,
            string orderBy, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 查询分页列表
        /// </summary>
        Task<PaginationList<Orders>> QueryPageAsync(int pageSize, int pageIndex, Expression<Func<Orders, bool>> funcWhere,
            string orderBy, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 获取记录总数量
        /// </summary>
        Task<int> QueryCountAsync(Expression<Func<Orders, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 获取订单总金额
        /// </summary>
        Task<decimal> QueryAmountAsync(Expression<Func<Orders, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Read);

        /// <summary>
        /// 添加订单
        /// </summary>
        Task<OrderCollectionDto?> AddAsync(OrdersAddDto modelDto, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 修改一条记录
        /// </summary>
        Task<bool> UpdateAsync(Expression<Func<Orders, bool>> funcWhere, OrdersEditDto modelDto, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 签收订单(管理员)
        /// </summary>
        Task<bool> ReceiptAsync(Expression<Func<Orders, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 完成订单(管理员)
        /// </summary>
        Task<bool> CompleteAsync(Expression<Func<Orders, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 作废订单(管理员)
        /// </summary>
        Task<bool> InvalidAsync(Expression<Func<Orders, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 取消订单(客户)
        /// </summary>
        Task<bool> CancelAsync(long id, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 确认收货(客户)
        /// </summary>
        Task<bool> ConfirmAsync(long id, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 根据条件删除记录
        /// </summary>
        Task<bool> DeleteAsync(Expression<Func<Orders, bool>> funcWhere, WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 完成订单(计划任务)
        /// </summary>
        Task JobCompleteAsync(WriteRoRead writeAndRead = WriteRoRead.Write);

        /// <summary>
        /// 结算订单(计划任务)
        /// </summary>
        Task JobSettleAsync(WriteRoRead writeAndRead = WriteRoRead.Write);
    }
}
